{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 0,
   "metadata": {
    "id": "xbpUmD7-S5Rk",
    "colab_type": "code",
    "outputId": "fbe20ad0-2067-43f8-9530-bf53a7bee158",
    "executionInfo": {
     "status": "ok",
     "timestamp": 1.573607277069E12,
     "user_tz": -480.0,
     "elapsed": 1211.0,
     "user": {
      "displayName": "quan deng",
      "photoUrl": "",
      "userId": "05457504581213739574"
     }
    },
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 34.0
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello world\n"
     ]
    }
   ],
   "source": [
    "print('hello world')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "id": "jOnCE-JfS5Rz",
    "colab_type": "code",
    "outputId": "3efa305c-7b30-4350-e720-c44ddb27867f",
    "executionInfo": {
     "status": "ok",
     "timestamp": 1.574063184063E12,
     "user_tz": -480.0,
     "elapsed": 35819.0,
     "user": {
      "displayName": "quan deng",
      "photoUrl": "",
      "userId": "05457504581213739574"
     }
    },
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 121.0
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Go to this URL in a browser: https://accounts.google.com/o/oauth2/auth?client_id=947318989803-6bn6qk8qdgf4n4g3pfee6491hc0brc4i.apps.googleusercontent.com&redirect_uri=urn%3aietf%3awg%3aoauth%3a2.0%3aoob&response_type=code&scope=email%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdocs.test%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive.photos.readonly%20https%3a%2f%2fwww.googleapis.com%2fauth%2fpeopleapi.readonly\n",
      "\n",
      "Enter your authorization code:\n",
      "··········\n",
      "Mounted at /content/drive\n"
     ]
    }
   ],
   "source": [
    "from google.colab import drive\n",
    "drive.mount('/content/drive')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "id": "Z1w6vEXYTZ7Z",
    "colab_type": "code",
    "outputId": "1e0a6486-44ab-4c51-ef89-e932a4ef330e",
    "executionInfo": {
     "status": "ok",
     "timestamp": 1.574044600478E12,
     "user_tz": -480.0,
     "elapsed": 2606.0,
     "user": {
      "displayName": "quan deng",
      "photoUrl": "",
      "userId": "05457504581213739574"
     }
    },
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 67.0
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CommonSearch\t       data\t     GPU_Test.pyc  Rule_Base_Expert_System\n",
      "COMP7015_Mini_Project  DecisionTree  IT_Project    test.py\n",
      "control.ipynb\t       GPU_Test.py   __pycache__\n"
     ]
    }
   ],
   "source": [
    "!ls drive/'My Drive'/'Colab Notebooks'/HKBU_AI_Classs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "id": "47Oo1kL9TmwD",
    "colab_type": "code",
    "outputId": "d3ea5e83-6b8e-46b6-bce5-5ea3d7eb54f4",
    "executionInfo": {
     "status": "ok",
     "timestamp": 1.574063135006E12,
     "user_tz": -480.0,
     "elapsed": 2341.0,
     "user": {
      "displayName": "quan deng",
      "photoUrl": "",
      "userId": "05457504581213739574"
     }
    },
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 185.0
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/content/drive/My Drive/Colab Notebooks/HKBU_AI_Classs\n",
      "\n",
      "/env/python\n",
      "/usr/lib/python36.zip\n",
      "/usr/lib/python3.6\n",
      "/usr/lib/python3.6/lib-dynload\n",
      "/usr/local/lib/python3.6/dist-packages\n",
      "/usr/lib/python3/dist-packages\n",
      "/usr/local/lib/python3.6/dist-packages/IPython/extensions\n",
      "/root/.ipython\n"
     ]
    }
   ],
   "source": [
    "import sys\n",
    "\n",
    "sys.path.insert(0, '/content/drive/My Drive/Colab Notebooks/HKBU_AI_Classs')\n",
    "\n",
    "for path in sys.path:\n",
    "  print(path)\n",
    "\n",
    "%tensorflow_version 1.x\n",
    "\n",
    "# import GPU_Test\n",
    "# GPU_Test.run()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 0,
   "metadata": {
    "id": "pgMEkm32s51J",
    "colab_type": "code",
    "outputId": "360a8644-bfe2-44b4-b1f1-cd4ec84ed49d",
    "executionInfo": {
     "status": "ok",
     "timestamp": 1.573628733784E12,
     "user_tz": -480.0,
     "elapsed": 1841.0,
     "user": {
      "displayName": "quan deng",
      "photoUrl": "",
      "userId": "05457504581213739574"
     }
    },
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 34.0
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello project\n"
     ]
    }
   ],
   "source": [
    "from COMP7015_Mini_Project import Test\n",
    "Test.run()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 0,
   "metadata": {
    "id": "lo3Uxwxuy_sq",
    "colab_type": "code",
    "outputId": "023faf3a-f694-4bb4-dfc8-2c3da4c3eb9f",
    "executionInfo": {
     "status": "ok",
     "timestamp": 1.573778418948E12,
     "user_tz": -480.0,
     "elapsed": 5097.0,
     "user": {
      "displayName": "quan deng",
      "photoUrl": "",
      "userId": "05457504581213739574"
     }
    },
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 34.0
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Using TensorFlow backend.\n"
     ]
    }
   ],
   "source": [
    "from COMP7015_Mini_Project.Data import Data_Loader"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 0,
   "metadata": {
    "id": "ZMWKr2IRz_uH",
    "colab_type": "code",
    "colab": {}
   },
   "outputs": [],
   "source": [
    "Data_Loader.run()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "id": "2PFiO6oc1FFk",
    "colab_type": "code",
    "outputId": "3adb3400-f76f-4ee9-c21c-9c6ab1d4dd59",
    "executionInfo": {
     "status": "error",
     "timestamp": 1.574063139429E12,
     "user_tz": -480.0,
     "elapsed": 1591.0,
     "user": {
      "displayName": "quan deng",
      "photoUrl": "",
      "userId": "05457504581213739574"
     }
    },
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 299.0
    }
   },
   "outputs": [
    {
     "ename": "ModuleNotFoundError",
     "evalue": "ignored",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mModuleNotFoundError\u001b[0m                       Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-2-709f1a906704>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mCOMP7015_Mini_Project\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtrain\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mtrain_cifar\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'COMP7015_Mini_Project'",
      "",
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0;32m\nNOTE: If your import is failing due to a missing package, you can\nmanually install dependencies using either !pip or !apt.\n\nTo view examples of installing some common dependencies, click the\n\"Open Examples\" button below.\n\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n"
     ],
     "output_type": "error"
    }
   ],
   "source": [
    "from COMP7015_Mini_Project.train import train_cifar"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 0,
   "metadata": {
    "id": "MnvIcArTjb8K",
    "colab_type": "code",
    "colab": {}
   },
   "outputs": [],
   "source": [
    "!cat drive/'My Drive'/'Colab Notebooks'/HKBU_AI_Classs/COMP7015_Mini_Project/train/train_cifar.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 0,
   "metadata": {
    "id": "DWEYM1_sYbJC",
    "colab_type": "code",
    "colab": {}
   },
   "outputs": [],
   "source": [
    "!cat drive/'My Drive'/'Colab Notebooks'/HKBU_AI_Classs/COMP7015_Mini_Project/Model_Structure/Basic_inception.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 0,
   "metadata": {
    "id": "cJ3KLyBIRkEu",
    "colab_type": "code",
    "colab": {}
   },
   "outputs": [],
   "source": [
    "!cat drive/'My Drive'/'Colab Notebooks'/HKBU_AI_Classs/COMP7015_Mini_Project/train/nets_factory.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 0,
   "metadata": {
    "id": "yecbCBYp1Wk8",
    "colab_type": "code",
    "colab": {}
   },
   "outputs": [],
   "source": [
    "train_cifar.run('mini_resnet', epoch=20, use_preprocess=True, use_zcore=True, is_save=True, is_restore=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 0,
   "metadata": {
    "id": "_iP23wVL4-vC",
    "colab_type": "code",
    "colab": {}
   },
   "outputs": [],
   "source": [
    "train_cifar.run('mini_cnn', epoch=20, use_preprocess=True, use_zcore=True, is_save=True, is_restore=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 0,
   "metadata": {
    "id": "NFXfWGc-8UXu",
    "colab_type": "code",
    "colab": {}
   },
   "outputs": [],
   "source": [
    "train_cifar.run('mini_inception', epoch=20, use_preprocess=True, use_zcore=False, is_save=True, is_restore=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 0,
   "metadata": {
    "id": "-5ZpdJlzXez_",
    "colab_type": "code",
    "colab": {}
   },
   "outputs": [],
   "source": [
    "train_cifar.run('cnn', epoch=20, use_preprocess=True, use_zcore=True, is_save=True, is_restore=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 0,
   "metadata": {
    "id": "vBd4fiiz8ZaF",
    "colab_type": "code",
    "colab": {}
   },
   "outputs": [],
   "source": [
    "train_cifar.run('inception', epoch=20, use_preprocess=True, use_zcore=True, is_save=True, is_restore=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 0,
   "metadata": {
    "id": "DtKcAlmB8K7C",
    "colab_type": "code",
    "colab": {}
   },
   "outputs": [],
   "source": [
    "train_cifar.run('resnet', epoch=20, use_preprocess=True, use_zcore=True, is_save=True, is_restore=False, special='_e')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 0,
   "metadata": {
    "id": "kqYZDqzmQqIQ",
    "colab_type": "code",
    "colab": {}
   },
   "outputs": [],
   "source": [
    "train_cifar.run('resnet_improved_v1', epoch=20, use_preprocess=True, use_zcore=True, is_save=True, is_restore=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 0,
   "metadata": {
    "id": "3lPUigUlXwMw",
    "colab_type": "code",
    "colab": {}
   },
   "outputs": [],
   "source": [
    "train_cifar.run('inception_improved_v1', epoch=20, use_preprocess=True, use_zcore=True, is_save=True, is_restore=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 0,
   "metadata": {
    "id": "cWJvKbwXmBJ0",
    "colab_type": "code",
    "colab": {}
   },
   "outputs": [],
   "source": [
    "from COMP7015_Mini_Project.Log import Analysis"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 0,
   "metadata": {
    "id": "o7dlALxwfDdn",
    "colab_type": "code",
    "colab": {}
   },
   "outputs": [],
   "source": [
    "from COMP7015_Mini_Project.train import test_cifar"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 0,
   "metadata": {
    "id": "3EVqMB1ffU0V",
    "colab_type": "code",
    "colab": {}
   },
   "outputs": [],
   "source": [
    "test_cifar.run(model_name='inception_improved_v1', use_preprocess=True, use_zcore=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 0,
   "metadata": {
    "id": "9bbZeyjcf_SM",
    "colab_type": "code",
    "colab": {}
   },
   "outputs": [],
   "source": [
    "test_cifar.run(model_name='resnet_improved_v1', use_preprocess=True, use_zcore=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 0,
   "metadata": {
    "id": "qAY3qBZXn8C2",
    "colab_type": "code",
    "colab": {}
   },
   "outputs": [],
   "source": [
    "Analysis.run()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "name": "python3",
   "display_name": "Python 3"
  },
  "colab": {
   "name": "control.ipynb",
   "provenance": [],
   "collapsed_sections": []
  },
  "accelerator": "GPU"
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
